package com.example.comiccenter.service.implt;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.comiccenter.dao.AdminMapper;
import com.example.comiccenter.domain.Admin;
import com.example.comiccenter.service.AdminService;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class AdminServiceImpl implements AdminService{
    @Resource
    AdminMapper adminmapper;
//登陆验证
    @Override
    public boolean verifyPassword(String adminname,String password){
        return adminmapper.verifyPassword(adminname,password)>0;
    }
    //添加管理员
    @Override
    public int insertAdmin(Admin admin){
        return adminmapper.insert(admin);
    }
    //删除管理员
    @Override
    public int deleteAdmin(Integer Id){
        return adminmapper.deleteById(Id);
    }
    @Override
    public Page<Admin> getSelectAdminList(Integer PageNum, Integer PageSize, LambdaQueryWrapper<Admin> wrapper){
        return adminmapper.selectPage(new Page<>(PageNum,PageSize),wrapper);
    }

    @Override
    public int updateAdmin(Admin admin){
        return adminmapper.updateById(admin);
    }
}
